home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / gas_251.zip / bin_251 / bfd / ecoffswap.h < prev    next >
C/C++ Source or Header  |  1994-08-24  |  30KB  |  825 lines

  1. /* Generic ECOFF swapping routines, for BFD.
  2.    Copyright 1992, 1993 Free Software Foundation, Inc.
  3.    Written by Cygnus Support.
  4.  
  5. This file is part of BFD, the Binary File Descriptor library.
  6.  
  7. This program is free software; you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation; either version 2 of the License, or
  10. (at your option) any later version.
  11.  
  12. This program is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. GNU General Public License for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with this program; if not, write to the Free Software
  19. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  20.  
  21. /* NOTE: This is a header file, but it contains executable routines.
  22.    This is done this way because these routines are substantially
  23.    similar, but are not identical, for all ECOFF targets.
  24.  
  25.    These are routines to swap the ECOFF symbolic information in and
  26.    out.  The routines are defined statically.  You can set breakpoints
  27.    on them in gdb by naming the including source file; e.g.,
  28.    'coff-mips.c':ecoff_swap_hdr_in.
  29.  
  30.    Before including this header file, one of ECOFF_32 or ECOFF_64 must
  31.    be defined.  These are checked when swapping information that
  32.    depends upon the target size.  This code works for 32 bit and 64
  33.    bit ECOFF, but may need to be generalized in the future.
  34.  
  35.    Some header file which defines the external forms of these
  36.    structures must also be included before including this header file.
  37.    Currently this is either coff/mips.h or coff/alpha.h.
  38.  
  39.    If the symbol TEST is defined when this file is compiled, a
  40.    comparison is made to ensure that, in fact, the output is
  41.    bit-for-bit the same as the input.  Of course, this symbol should
  42.    only be defined when deliberately testing the code on a machine
  43.    with the proper byte sex and such.  */
  44.  
  45. #ifdef ECOFF_32
  46. #define ecoff_get_off bfd_h_get_32
  47. #define ecoff_put_off bfd_h_put_32
  48. #endif
  49. #ifdef ECOFF_64
  50. #define ecoff_get_off bfd_h_get_64
  51. #define ecoff_put_off bfd_h_put_64
  52. #endif
  53.  
  54. /* ECOFF auxiliary information swapping routines.  These are the same
  55.    for all ECOFF targets, so they are defined in ecoff.c.  */
  56. extern void _bfd_ecoff_swap_tir_in
  57.   PARAMS ((int, const struct tir_ext *, TIR *));
  58. extern void _bfd_ecoff_swap_tir_out
  59.   PARAMS ((int, const TIR *, struct tir_ext *));
  60. extern void _bfd_ecoff_swap_rndx_in
  61.   PARAMS ((int, const struct rndx_ext *, RNDXR *));
  62. extern void _bfd_ecoff_swap_rndx_out
  63.   PARAMS ((int, const RNDXR *, struct rndx_ext *));
  64.  
  65. /* Swap in the symbolic header.  */
  66.  
  67. static void
  68. ecoff_swap_hdr_in (abfd, ext_copy, intern)
  69.      bfd *abfd;
  70.      PTR ext_copy;
  71.      HDRR *intern;
  72. {
  73.   struct hdr_ext ext[1];
  74.  
  75.   *ext = *(struct hdr_ext *) ext_copy;
  76.  
  77.   intern->magic         = bfd_h_get_signed_16 (abfd, (bfd_byte *)ext->h_magic);
  78.   intern->vstamp        = bfd_h_get_signed_16 (abfd, (bfd_byte *)ext->h_vstamp);
  79.   intern->ilineMax      = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_ilineMax);
  80.   intern->cbLine        = ecoff_get_off (abfd, (bfd_byte *)ext->h_cbLine);
  81.   intern->cbLineOffset  = ecoff_get_off (abfd, (bfd_byte *)ext->h_cbLineOffset);
  82.   intern->idnMax        = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_idnMax);
  83.   intern->cbDnOffset    = ecoff_get_off (abfd, (bfd_byte *)ext->h_cbDnOffset);
  84.   intern->ipdMax        = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_ipdMax);
  85.   intern->cbPdOffset    = ecoff_get_off (abfd, (bfd_byte *)ext->h_cbPdOffset);
  86.   intern->isymMax       = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_isymMax);
  87.   intern->cbSymOffset   = ecoff_get_off (abfd, (bfd_byte *)ext->h_cbSymOffset);
  88.   intern->ioptMax       = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_ioptMax);
  89.   intern->cbOptOffset   = ecoff_get_off (abfd, (bfd_byte *)ext->h_cbOptOffset);
  90.   intern->iauxMax       = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_iauxMax);
  91.   intern->cbAuxOffset   = ecoff_get_off (abfd, (bfd_byte *)ext->h_cbAuxOffset);
  92.   intern->issMax        = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_issMax);
  93.   intern->cbSsOffset    = ecoff_get_off (abfd, (bfd_byte *)ext->h_cbSsOffset);
  94.   intern->issExtMax     = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_issExtMax);
  95.   intern->cbSsExtOffset = ecoff_get_off (abfd, (bfd_byte *)ext->h_cbSsExtOffset);
  96.   intern->ifdMax        = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_ifdMax);
  97.   intern->cbFdOffset    = ecoff_get_off (abfd, (bfd_byte *)ext->h_cbFdOffset);
  98.   intern->crfd          = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_crfd);
  99.   intern->cbRfdOffset   = ecoff_get_off (abfd, (bfd_byte *)ext->h_cbRfdOffset);
  100.   intern->iextMax       = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_iextMax);
  101.   intern->cbExtOffset   = ecoff_get_off (abfd, (bfd_byte *)ext->h_cbExtOffset);
  102.  
  103. #ifdef TEST
  104.   if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
  105.     abort();
  106. #endif
  107. }
  108.  
  109. /* Swap out the symbolic header.  */
  110.  
  111. static void
  112. ecoff_swap_hdr_out (abfd, intern_copy, ext_ptr)
  113.      bfd *abfd;
  114.      const HDRR *intern_copy;
  115.      PTR ext_ptr;
  116. {
  117.   struct hdr_ext *ext = (struct hdr_ext *) ext_ptr;
  118.   HDRR intern[1];
  119.  
  120.   *intern = *intern_copy;
  121.  
  122.   bfd_h_put_signed_16 (abfd, intern->magic, (bfd_byte *)ext->h_magic);
  123.   bfd_h_put_signed_16 (abfd, intern->vstamp, (bfd_byte *)ext->h_vstamp);
  124.   bfd_h_put_32 (abfd, intern->ilineMax, (bfd_byte *)ext->h_ilineMax);
  125.   ecoff_put_off (abfd, intern->cbLine, (bfd_byte *)ext->h_cbLine);
  126.   ecoff_put_off (abfd, intern->cbLineOffset, (bfd_byte *)ext->h_cbLineOffset);
  127.   bfd_h_put_32 (abfd, intern->idnMax, (bfd_byte *)ext->h_idnMax);
  128.   ecoff_put_off (abfd, intern->cbDnOffset, (bfd_byte *)ext->h_cbDnOffset);
  129.   bfd_h_put_32 (abfd, intern->ipdMax, (bfd_byte *)ext->h_ipdMax);
  130.   ecoff_put_off (abfd, intern->cbPdOffset, (bfd_byte *)ext->h_cbPdOffset);
  131.   bfd_h_put_32 (abfd, intern->isymMax, (bfd_byte *)ext->h_isymMax);
  132.   ecoff_put_off (abfd, intern->cbSymOffset, (bfd_byte *)ext->h_cbSymOffset);
  133.   bfd_h_put_32 (abfd, intern->ioptMax, (bfd_byte *)ext->h_ioptMax);
  134.   ecoff_put_off (abfd, intern->cbOptOffset, (bfd_byte *)ext->h_cbOptOffset);
  135.   bfd_h_put_32 (abfd, intern->iauxMax, (bfd_byte *)ext->h_iauxMax);
  136.   ecoff_put_off (abfd, intern->cbAuxOffset, (bfd_byte *)ext->h_cbAuxOffset);
  137.   bfd_h_put_32 (abfd, intern->issMax, (bfd_byte *)ext->h_issMax);
  138.   ecoff_put_off (abfd, intern->cbSsOffset, (bfd_byte *)ext->h_cbSsOffset);
  139.   bfd_h_put_32 (abfd, intern->issExtMax, (bfd_byte *)ext->h_issExtMax);
  140.   ecoff_put_off (abfd, intern->cbSsExtOffset, (bfd_byte *)ext->h_cbSsExtOffset);
  141.   bfd_h_put_32 (abfd, intern->ifdMax, (bfd_byte *)ext->h_ifdMax);
  142.   ecoff_put_off (abfd, intern->cbFdOffset, (bfd_byte *)ext->h_cbFdOffset);
  143.   bfd_h_put_32 (abfd, intern->crfd, (bfd_byte *)ext->h_crfd);
  144.   ecoff_put_off (abfd, intern->cbRfdOffset, (bfd_byte *)ext->h_cbRfdOffset);
  145.   bfd_h_put_32 (abfd, intern->iextMax, (bfd_byte *)ext->h_iextMax);
  146.   ecoff_put_off (abfd, intern->cbExtOffset, (bfd_byte *)ext->h_cbExtOffset);
  147.  
  148. #ifdef TEST
  149.   if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
  150.     abort();
  151. #endif
  152. }
  153.  
  154. /* Swap in the file descriptor record.  */
  155.  
  156. static void
  157. ecoff_swap_fdr_in (abfd, ext_copy, intern)
  158.      bfd *abfd;
  159.      PTR ext_copy;
  160.      FDR *intern;
  161. {
  162.   struct fdr_ext ext[1];
  163.  
  164.   *ext = *(struct fdr_ext *) ext_copy;
  165.   
  166.   intern->adr           = ecoff_get_off (abfd, (bfd_byte *)ext->f_adr);
  167.   intern->rss           = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_rss);
  168.   intern->issBase       = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_issBase);
  169.   intern->cbSs          = ecoff_get_off (abfd, (bfd_byte *)ext->f_cbSs);
  170.   intern->isymBase      = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_isymBase);
  171.   intern->csym          = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_csym);
  172.   intern->ilineBase     = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_ilineBase);
  173.   intern->cline         = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_cline);
  174.   intern->ioptBase      = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_ioptBase);
  175.   intern->copt          = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_copt);
  176. #ifdef ECOFF_32
  177.   intern->ipdFirst      = bfd_h_get_16 (abfd, (bfd_byte *)ext->f_ipdFirst);
  178.   intern->cpd           = bfd_h_get_16 (abfd, (bfd_byte *)ext->f_cpd);
  179. #endif
  180. #ifdef ECOFF_64
  181.   intern->ipdFirst      = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_ipdFirst);
  182.   intern->cpd           = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_cpd);
  183. #endif
  184.   intern->iauxBase      = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_iauxBase);
  185.   intern->caux          = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_caux);
  186.   intern->rfdBase       = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_rfdBase);
  187.   intern->crfd          = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_crfd);
  188.  
  189.   /* now the fun stuff... */
  190.   if (abfd->xvec->header_byteorder_big_p != false) {
  191.     intern->lang        = (ext->f_bits1[0] & FDR_BITS1_LANG_BIG)
  192.                     >> FDR_BITS1_LANG_SH_BIG;
  193.     intern->fMerge      = 0 != (ext->f_bits1[0] & FDR_BITS1_FMERGE_BIG);
  194.     intern->fReadin     = 0 != (ext->f_bits1[0] & FDR_BITS1_FREADIN_BIG);
  195.     intern->fBigendian  = 0 != (ext->f_bits1[0] & FDR_BITS1_FBIGENDIAN_BIG);
  196.     intern->glevel      = (ext->f_bits2[0] & FDR_BITS2_GLEVEL_BIG)
  197.                     >> FDR_BITS2_GLEVEL_SH_BIG;
  198.   } else {
  199.     intern->lang        = (ext->f_bits1[0] & FDR_BITS1_LANG_LITTLE)
  200.                     >> FDR_BITS1_LANG_SH_LITTLE;
  201.     intern->fMerge      = 0 != (ext->f_bits1[0] & FDR_BITS1_FMERGE_LITTLE);
  202.     intern->fReadin     = 0 != (ext->f_bits1[0] & FDR_BITS1_FREADIN_LITTLE);
  203.     intern->fBigendian  = 0 != (ext->f_bits1[0] & FDR_BITS1_FBIGENDIAN_LITTLE);
  204.     intern->glevel      = (ext->f_bits2[0] & FDR_BITS2_GLEVEL_LITTLE)
  205.                     >> FDR_BITS2_GLEVEL_SH_LITTLE;
  206.   }
  207.   intern->reserved = 0;
  208.  
  209.   intern->cbLineOffset  = ecoff_get_off (abfd, (bfd_byte *)ext->f_cbLineOffset);
  210.   intern->cbLine        = ecoff_get_off (abfd, (bfd_byte *)ext->f_cbLine);
  211.  
  212. #ifdef TEST
  213.   if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
  214.     abort();
  215. #endif
  216. }
  217.  
  218. /* Swap out the file descriptor record.  */
  219.  
  220. static void
  221. ecoff_swap_fdr_out (abfd, intern_copy, ext_ptr)
  222.      bfd *abfd;
  223.      const FDR *intern_copy;
  224.      PTR ext_ptr;
  225. {
  226.   struct fdr_ext *ext = (struct fdr_ext *) ext_ptr;
  227.   FDR intern[1];
  228.  
  229.   *intern = *intern_copy;    /* Make it reasonable to do in-place.  */
  230.   
  231.   ecoff_put_off (abfd, intern->adr, (bfd_byte *)ext->f_adr);
  232.   bfd_h_put_32 (abfd, intern->rss, (bfd_byte *)ext->f_rss);
  233.   bfd_h_put_32 (abfd, intern->issBase, (bfd_byte *)ext->f_issBase);
  234.   ecoff_put_off (abfd, intern->cbSs, (bfd_byte *)ext->f_cbSs);
  235.   bfd_h_put_32 (abfd, intern->isymBase, (bfd_byte *)ext->f_isymBase);
  236.   bfd_h_put_32 (abfd, intern->csym, (bfd_byte *)ext->f_csym);
  237.   bfd_h_put_32 (abfd, intern->ilineBase, (bfd_byte *)ext->f_ilineBase);
  238.   bfd_h_put_32 (abfd, intern->cline, (bfd_byte *)ext->f_cline);
  239.   bfd_h_put_32 (abfd, intern->ioptBase, (bfd_byte *)ext->f_ioptBase);
  240.   bfd_h_put_32 (abfd, intern->copt, (bfd_byte *)ext->f_copt);
  241. #ifdef ECOFF_32
  242.   bfd_h_put_16 (abfd, intern->ipdFirst, (bfd_byte *)ext->f_ipdFirst);
  243.   bfd_h_put_16 (abfd, intern->cpd, (bfd_byte *)ext->f_cpd);
  244. #endif
  245. #ifdef ECOFF_64
  246.   bfd_h_put_32 (abfd, intern->ipdFirst, (bfd_byte *)ext->f_ipdFirst);
  247.   bfd_h_put_32 (abfd, intern->cpd, (bfd_byte *)ext->f_cpd);
  248. #endif
  249.   bfd_h_put_32 (abfd, intern->iauxBase, (bfd_byte *)ext->f_iauxBase);
  250.   bfd_h_put_32 (abfd, intern->caux, (bfd_byte *)ext->f_caux);
  251.   bfd_h_put_32 (abfd, intern->rfdBase, (bfd_byte *)ext->f_rfdBase);
  252.   bfd_h_put_32 (abfd, intern->crfd, (bfd_byte *)ext->f_crfd);
  253.  
  254.   /* now the fun stuff... */
  255.   if (abfd->xvec->header_byteorder_big_p != false) {
  256.     ext->f_bits1[0] = (((intern->lang << FDR_BITS1_LANG_SH_BIG)
  257.             & FDR_BITS1_LANG_BIG)
  258.                | (intern->fMerge ? FDR_BITS1_FMERGE_BIG : 0)
  259.                | (intern->fReadin ? FDR_BITS1_FREADIN_BIG : 0)
  260.                | (intern->fBigendian ? FDR_BITS1_FBIGENDIAN_BIG : 0));
  261.     ext->f_bits2[0] = ((intern->glevel << FDR_BITS2_GLEVEL_SH_BIG)
  262.                & FDR_BITS2_GLEVEL_BIG);
  263.     ext->f_bits2[1] = 0;
  264.     ext->f_bits2[2] = 0;
  265.   } else {
  266.     ext->f_bits1[0] = (((intern->lang << FDR_BITS1_LANG_SH_LITTLE)
  267.             & FDR_BITS1_LANG_LITTLE)
  268.                | (intern->fMerge ? FDR_BITS1_FMERGE_LITTLE : 0)
  269.                | (intern->fReadin ? FDR_BITS1_FREADIN_LITTLE : 0)
  270.                | (intern->fBigendian ? FDR_BITS1_FBIGENDIAN_LITTLE : 0));
  271.     ext->f_bits2[0] = ((intern->glevel << FDR_BITS2_GLEVEL_SH_LITTLE)
  272.                & FDR_BITS2_GLEVEL_LITTLE);
  273.     ext->f_bits2[1] = 0;
  274.     ext->f_bits2[2] = 0;
  275.   }
  276.  
  277.   ecoff_put_off (abfd, intern->cbLineOffset, (bfd_byte *)ext->f_cbLineOffset);
  278.   ecoff_put_off (abfd, intern->cbLine, (bfd_byte *)ext->f_cbLine);
  279.  
  280. #ifdef TEST
  281.   if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
  282.     abort();
  283. #endif
  284. }
  285.  
  286. /* start-sanitize-mpw */
  287. #ifndef MPW_C
  288. /* end-sanitize-mpw */
  289. /* Swap in the procedure descriptor record.  */
  290.  
  291. static void
  292. ecoff_swap_pdr_in (abfd, ext_copy, intern)
  293.      bfd *abfd;
  294.      PTR ext_copy;
  295.      PDR *intern;
  296. {
  297.   struct pdr_ext ext[1];
  298.  
  299.   *ext = *(struct pdr_ext *) ext_copy;
  300.   
  301.   intern->adr           = ecoff_get_off (abfd, (bfd_byte *)ext->p_adr);
  302.   intern->isym          = bfd_h_get_32 (abfd, (bfd_byte *)ext->p_isym);
  303.   intern->iline         = bfd_h_get_32 (abfd, (bfd_byte *)ext->p_iline);
  304.   intern->regmask       = bfd_h_get_32 (abfd, (bfd_byte *)ext->p_regmask);
  305.   intern->regoffset     = bfd_h_get_signed_32 (abfd,
  306.                            (bfd_byte *)ext->p_regoffset);
  307.   intern->iopt          = bfd_h_get_signed_32 (abfd, (bfd_byte *)ext->p_iopt);
  308.   intern->fregmask      = bfd_h_get_32 (abfd, (bfd_byte *)ext->p_fregmask);
  309.   intern->fregoffset    = bfd_h_get_signed_32 (abfd,
  310.                            (bfd_byte *)ext->p_fregoffset);
  311.   intern->frameoffset   = bfd_h_get_signed_32 (abfd,
  312.                            (bfd_byte *)ext->p_frameoffset);
  313.   intern->framereg      = bfd_h_get_16 (abfd, (bfd_byte *)ext->p_framereg);
  314.   intern->pcreg         = bfd_h_get_16 (abfd, (bfd_byte *)ext->p_pcreg);
  315.   intern->lnLow         = bfd_h_get_32 (abfd, (bfd_byte *)ext->p_lnLow);
  316.   intern->lnHigh        = bfd_h_get_32 (abfd, (bfd_byte *)ext->p_lnHigh);
  317.   intern->cbLineOffset  = ecoff_get_off (abfd, (bfd_byte *)ext->p_cbLineOffset);
  318.  
  319. #ifdef ECOFF_64
  320.   intern->gp_prologue = bfd_h_get_8 (abfd, (bfd_byte *) ext->p_gp_prologue);
  321.   if (abfd->xvec->header_byteorder_big_p != false)
  322.     {
  323.       intern->gp_used = 0 != (ext->p_bits1[0] & PDR_BITS1_GP_USED_BIG);
  324.       intern->reg_frame = 0 != (ext->p_bits1[0] & PDR_BITS1_REG_FRAME_BIG);
  325.       intern->reserved = (((ext->p_bits1[0] & PDR_BITS1_RESERVED_BIG)
  326.                << PDR_BITS1_RESERVED_SH_LEFT_BIG)
  327.               | ((ext->p_bits2[0] & PDR_BITS2_RESERVED_BIG)
  328.                  >> PDR_BITS2_RESERVED_SH_BIG));
  329.     }
  330.   else
  331.     {
  332.       intern->gp_used = 0 != (ext->p_bits1[0] & PDR_BITS1_GP_USED_LITTLE);
  333.       intern->reg_frame = 0 != (ext->p_bits1[0] & PDR_BITS1_REG_FRAME_LITTLE);
  334.       intern->reserved = (((ext->p_bits1[0] & PDR_BITS1_RESERVED_LITTLE)
  335.                >> PDR_BITS1_RESERVED_SH_LITTLE)
  336.               | ((ext->p_bits2[0] & PDR_BITS2_RESERVED_LITTLE)
  337.                  << PDR_BITS2_RESERVED_SH_LEFT_LITTLE));
  338.     }
  339.   intern->localoff = bfd_h_get_8 (abfd, (bfd_byte *) ext->p_localoff);
  340. #endif  
  341.  
  342. #ifdef TEST
  343.   if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
  344.     abort();
  345. #endif
  346. }
  347.  
  348. /* Swap out the procedure descriptor record.  */
  349.  
  350. static void
  351. ecoff_swap_pdr_out (abfd, intern_copy, ext_ptr)
  352.      bfd *abfd;
  353.      const PDR *intern_copy;
  354.      PTR ext_ptr;
  355. {
  356.   struct pdr_ext *ext = (struct pdr_ext *) ext_ptr;
  357.   PDR intern[1];
  358.  
  359.   *intern = *intern_copy;    /* Make it reasonable to do in-place.  */
  360.   
  361.   ecoff_put_off (abfd, intern->adr, (bfd_byte *)ext->p_adr);
  362.   bfd_h_put_32 (abfd, intern->isym, (bfd_byte *)ext->p_isym);
  363.   bfd_h_put_32 (abfd, intern->iline, (bfd_byte *)ext->p_iline);
  364.   bfd_h_put_32 (abfd, intern->regmask, (bfd_byte *)ext->p_regmask);
  365.   bfd_h_put_32 (abfd, intern->regoffset, (bfd_byte *)ext->p_regoffset);
  366.   bfd_h_put_32 (abfd, intern->iopt, (bfd_byte *)ext->p_iopt);
  367.   bfd_h_put_32 (abfd, intern->fregmask, (bfd_byte *)ext->p_fregmask);
  368.   bfd_h_put_32 (abfd, intern->fregoffset, (bfd_byte *)ext->p_fregoffset);
  369.   bfd_h_put_32 (abfd, intern->frameoffset, (bfd_byte *)ext->p_frameoffset);
  370.   bfd_h_put_16 (abfd, intern->framereg, (bfd_byte *)ext->p_framereg);
  371.   bfd_h_put_16 (abfd, intern->pcreg, (bfd_byte *)ext->p_pcreg);
  372.   bfd_h_put_32 (abfd, intern->lnLow, (bfd_byte *)ext->p_lnLow);
  373.   bfd_h_put_32 (abfd, intern->lnHigh, (bfd_byte *)ext->p_lnHigh);
  374.   ecoff_put_off (abfd, intern->cbLineOffset, (bfd_byte *)ext->p_cbLineOffset);
  375.  
  376. #ifdef ECOFF_64
  377.   bfd_h_put_8 (abfd, intern->gp_prologue, (bfd_byte *) ext->p_gp_prologue);
  378.   if (abfd->xvec->header_byteorder_big_p != false)
  379.     {
  380.       ext->p_bits1[0] = ((intern->gp_used ? PDR_BITS1_GP_USED_BIG : 0)
  381.              | (intern->reg_frame ? PDR_BITS1_REG_FRAME_BIG : 0)
  382.              | ((intern->reserved
  383.                  >> PDR_BITS1_RESERVED_SH_LEFT_BIG)
  384.                 & PDR_BITS1_RESERVED_BIG));
  385.       ext->p_bits2[0] = ((intern->reserved << PDR_BITS2_RESERVED_SH_BIG)
  386.              & PDR_BITS2_RESERVED_BIG);
  387.     }
  388.   else
  389.     {
  390.       ext->p_bits1[0] = ((intern->gp_used ? PDR_BITS1_GP_USED_LITTLE : 0)
  391.              | (intern->reg_frame ? PDR_BITS1_REG_FRAME_LITTLE : 0)
  392.              | ((intern->reserved << PDR_BITS1_RESERVED_SH_LITTLE)
  393.                 & PDR_BITS1_RESERVED_LITTLE));
  394.       ext->p_bits2[0] = ((intern->reserved >>
  395.               PDR_BITS2_RESERVED_SH_LEFT_LITTLE)
  396.              & PDR_BITS2_RESERVED_LITTLE);
  397.     }
  398.   bfd_h_put_8 (abfd, intern->localoff, (bfd_byte *) ext->p_localoff);
  399. #endif  
  400.  
  401. #ifdef TEST
  402.   if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
  403.     abort();
  404. #endif
  405. }
  406. /* start-sanitize-mpw */
  407. #else /* MPW_C */
  408. /* Same routines, but with ECOFF_64 code removed, so ^&%$#&! MPW C doesn't
  409.    corrupt itself and then freak out. */
  410. /* Swap in the procedure descriptor record.  */
  411.  
  412. static void
  413. ecoff_swap_pdr_in (abfd, ext_copy, intern)
  414.      bfd *abfd;
  415.      PTR ext_copy;
  416.      PDR *intern;
  417. {
  418.   struct pdr_ext ext[1];
  419.  
  420.   *ext = *(struct pdr_ext *) ext_copy;
  421.   
  422.   intern->adr           = ecoff_get_off (abfd, (bfd_byte *)ext->p_adr);
  423.   intern->isym          = bfd_h_get_32 (abfd, (bfd_byte *)ext->p_isym);
  424.   intern->iline         = bfd_h_get_32 (abfd, (bfd_byte *)ext->p_iline);
  425.   intern->regmask       = bfd_h_get_32 (abfd, (bfd_byte *)ext->p_regmask);
  426.   intern->regoffset     = bfd_h_get_signed_32 (abfd,
  427.                            (bfd_byte *)ext->p_regoffset);
  428.   intern->iopt          = bfd_h_get_signed_32 (abfd, (bfd_byte *)ext->p_iopt);
  429.   intern->fregmask      = bfd_h_get_32 (abfd, (bfd_byte *)ext->p_fregmask);
  430.   intern->fregoffset    = bfd_h_get_signed_32 (abfd,
  431.                            (bfd_byte *)ext->p_fregoffset);
  432.   intern->frameoffset   = bfd_h_get_signed_32 (abfd,
  433.                            (bfd_byte *)ext->p_frameoffset);
  434.   intern->framereg      = bfd_h_get_16 (abfd, (bfd_byte *)ext->p_framereg);
  435.   intern->pcreg         = bfd_h_get_16 (abfd, (bfd_byte *)ext->p_pcreg);
  436.   intern->lnLow         = bfd_h_get_32 (abfd, (bfd_byte *)ext->p_lnLow);
  437.   intern->lnHigh        = bfd_h_get_32 (abfd, (bfd_byte *)ext->p_lnHigh);
  438.   intern->cbLineOffset  = ecoff_get_off (abfd, (bfd_byte *)ext->p_cbLineOffset);
  439.  
  440. #ifdef TEST
  441.   if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
  442.     abort();
  443. #endif
  444. }
  445.  
  446. /* Swap out the procedure descriptor record.  */
  447.  
  448. static void
  449. ecoff_swap_pdr_out (abfd, intern_copy, ext_ptr)
  450.      bfd *abfd;
  451.      const PDR *intern_copy;
  452.      PTR ext_ptr;
  453. {
  454.   struct pdr_ext *ext = (struct pdr_ext *) ext_ptr;
  455.   PDR intern[1];
  456.  
  457.   *intern = *intern_copy;    /* Make it reasonable to do in-place.  */
  458.   
  459.   ecoff_put_off (abfd, intern->adr, (bfd_byte *)ext->p_adr);
  460.   bfd_h_put_32 (abfd, intern->isym, (bfd_byte *)ext->p_isym);
  461.   bfd_h_put_32 (abfd, intern->iline, (bfd_byte *)ext->p_iline);
  462.   bfd_h_put_32 (abfd, intern->regmask, (bfd_byte *)ext->p_regmask);
  463.   bfd_h_put_32 (abfd, intern->regoffset, (bfd_byte *)ext->p_regoffset);
  464.   bfd_h_put_32 (abfd, intern->iopt, (bfd_byte *)ext->p_iopt);
  465.   bfd_h_put_32 (abfd, intern->fregmask, (bfd_byte *)ext->p_fregmask);
  466.   bfd_h_put_32 (abfd, intern->fregoffset, (bfd_byte *)ext->p_fregoffset);
  467.   bfd_h_put_32 (abfd, intern->frameoffset, (bfd_byte *)ext->p_frameoffset);
  468.   bfd_h_put_16 (abfd, intern->framereg, (bfd_byte *)ext->p_framereg);
  469.   bfd_h_put_16 (abfd, intern->pcreg, (bfd_byte *)ext->p_pcreg);
  470.   bfd_h_put_32 (abfd, intern->lnLow, (bfd_byte *)ext->p_lnLow);
  471.   bfd_h_put_32 (abfd, intern->lnHigh, (bfd_byte *)ext->p_lnHigh);
  472.   ecoff_put_off (abfd, intern->cbLineOffset, (bfd_byte *)ext->p_cbLineOffset);
  473.  
  474. #ifdef TEST
  475.   if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
  476.     abort();
  477. #endif
  478. }
  479. #endif /* MPW_C */
  480. /* end-sanitize-mpw */
  481. /* Swap in a symbol record.  */
  482.  
  483. static void
  484. ecoff_swap_sym_in (abfd, ext_copy, intern)
  485.      bfd *abfd;
  486.      PTR ext_copy;
  487.      SYMR *intern;
  488. {
  489.   struct sym_ext ext[1];
  490.  
  491.   *ext = *(struct sym_ext *) ext_copy;
  492.   
  493.   intern->iss           = bfd_h_get_32 (abfd, (bfd_byte *)ext->s_iss);
  494.   intern->value         = ecoff_get_off (abfd, (bfd_byte *)ext->s_value);
  495.  
  496.   /* now the fun stuff... */
  497.   if (abfd->xvec->header_byteorder_big_p != false) {
  498.     intern->st          =  (ext->s_bits1[0] & SYM_BITS1_ST_BIG)
  499.                        >> SYM_BITS1_ST_SH_BIG;
  500.     intern->sc          = ((ext->s_bits1[0] & SYM_BITS1_SC_BIG)
  501.                        << SYM_BITS1_SC_SH_LEFT_BIG)
  502.             | ((ext->s_bits2[0] & SYM_BITS2_SC_BIG)
  503.                        >> SYM_BITS2_SC_SH_BIG);
  504.     intern->reserved    = 0 != (ext->s_bits2[0] & SYM_BITS2_RESERVED_BIG);
  505.     intern->index       = ((ext->s_bits2[0] & SYM_BITS2_INDEX_BIG)
  506.                        << SYM_BITS2_INDEX_SH_LEFT_BIG)
  507.             | (ext->s_bits3[0] << SYM_BITS3_INDEX_SH_LEFT_BIG)
  508.             | (ext->s_bits4[0] << SYM_BITS4_INDEX_SH_LEFT_BIG);
  509.   } else {
  510.     intern->st          =  (ext->s_bits1[0] & SYM_BITS1_ST_LITTLE)
  511.                        >> SYM_BITS1_ST_SH_LITTLE;
  512.     intern->sc          = ((ext->s_bits1[0] & SYM_BITS1_SC_LITTLE)
  513.                        >> SYM_BITS1_SC_SH_LITTLE)
  514.             | ((ext->s_bits2[0] & SYM_BITS2_SC_LITTLE)
  515.                        << SYM_BITS2_SC_SH_LEFT_LITTLE);
  516.     intern->reserved    = 0 != (ext->s_bits2[0] & SYM_BITS2_RESERVED_LITTLE);
  517.     intern->index       = ((ext->s_bits2[0] & SYM_BITS2_INDEX_LITTLE)
  518.                        >> SYM_BITS2_INDEX_SH_LITTLE)
  519.             | (ext->s_bits3[0] << SYM_BITS3_INDEX_SH_LEFT_LITTLE)
  520.             | ((unsigned int) ext->s_bits4[0]
  521.                << SYM_BITS4_INDEX_SH_LEFT_LITTLE);
  522.   }
  523.  
  524. #ifdef TEST
  525.   if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
  526.     abort();
  527. #endif
  528. }
  529.  
  530. /* Swap out a symbol record.  */
  531.  
  532. static void
  533. ecoff_swap_sym_out (abfd, intern_copy, ext_ptr)
  534.      bfd *abfd;
  535.      const SYMR *intern_copy;
  536.      PTR ext_ptr;
  537. {
  538.   struct sym_ext *ext = (struct sym_ext *) ext_ptr;
  539.   SYMR intern[1];
  540.  
  541.   *intern = *intern_copy;    /* Make it reasonable to do in-place.  */
  542.   
  543.   bfd_h_put_32 (abfd, intern->iss, (bfd_byte *)ext->s_iss);
  544.   ecoff_put_off (abfd, intern->value, (bfd_byte *)ext->s_value);
  545.  
  546.   /* now the fun stuff... */
  547.   if (abfd->xvec->header_byteorder_big_p != false) {
  548.     ext->s_bits1[0] = (((intern->st << SYM_BITS1_ST_SH_BIG)
  549.             & SYM_BITS1_ST_BIG)
  550.                | ((intern->sc >> SYM_BITS1_SC_SH_LEFT_BIG)
  551.               & SYM_BITS1_SC_BIG));
  552.     ext->s_bits2[0] = (((intern->sc << SYM_BITS2_SC_SH_BIG)
  553.             & SYM_BITS2_SC_BIG)
  554.                | (intern->reserved ? SYM_BITS2_RESERVED_BIG : 0)
  555.                | ((intern->index >> SYM_BITS2_INDEX_SH_LEFT_BIG)
  556.               & SYM_BITS2_INDEX_BIG));
  557.     ext->s_bits3[0] = (intern->index >> SYM_BITS3_INDEX_SH_LEFT_BIG) & 0xff;
  558.     ext->s_bits4[0] = (intern->index >> SYM_BITS4_INDEX_SH_LEFT_BIG) & 0xff;
  559.   } else {
  560.     ext->s_bits1[0] = (((intern->st << SYM_BITS1_ST_SH_LITTLE)
  561.             & SYM_BITS1_ST_LITTLE)
  562.                | ((intern->sc << SYM_BITS1_SC_SH_LITTLE)
  563.               & SYM_BITS1_SC_LITTLE));
  564.     ext->s_bits2[0] = (((intern->sc >> SYM_BITS2_SC_SH_LEFT_LITTLE)
  565.             & SYM_BITS2_SC_LITTLE)
  566.                | (intern->reserved ? SYM_BITS2_RESERVED_LITTLE : 0)
  567.                | ((intern->index << SYM_BITS2_INDEX_SH_LITTLE)
  568.               & SYM_BITS2_INDEX_LITTLE));
  569.     ext->s_bits3[0] = (intern->index >> SYM_BITS3_INDEX_SH_LEFT_LITTLE) & 0xff;
  570.     ext->s_bits4[0] = (intern->index >> SYM_BITS4_INDEX_SH_LEFT_LITTLE) & 0xff;
  571.   }
  572.  
  573. #ifdef TEST
  574.   if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
  575.     abort();
  576. #endif
  577. }
  578.  
  579. /* Swap in an external symbol record.  */
  580.  
  581. static void
  582. ecoff_swap_ext_in (abfd, ext_copy, intern)
  583.      bfd *abfd;
  584.      PTR ext_copy;
  585.      EXTR *intern;
  586. {
  587.   struct ext_ext ext[1];
  588.  
  589.   *ext = *(struct ext_ext *) ext_copy;
  590.   
  591.   /* now the fun stuff... */
  592.   if (abfd->xvec->header_byteorder_big_p != false) {
  593.     intern->jmptbl      = 0 != (ext->es_bits1[0] & EXT_BITS1_JMPTBL_BIG);
  594.     intern->cobol_main  = 0 != (ext->es_bits1[0] & EXT_BITS1_COBOL_MAIN_BIG);
  595.     intern->weakext     = 0 != (ext->es_bits1[0] & EXT_BITS1_WEAKEXT_BIG);
  596.   } else {
  597.     intern->jmptbl      = 0 != (ext->es_bits1[0] & EXT_BITS1_JMPTBL_LITTLE);
  598.     intern->cobol_main  = 0 != (ext->es_bits1[0] & EXT_BITS1_COBOL_MAIN_LITTLE);
  599.     intern->weakext     = 0 != (ext->es_bits1[0] & EXT_BITS1_WEAKEXT_LITTLE);
  600.   }
  601.   intern->reserved = 0;
  602.  
  603. #ifdef ECOFF_32
  604.   intern->ifd           = bfd_h_get_signed_16 (abfd, (bfd_byte *)ext->es_ifd);
  605. #endif
  606. #ifdef ECOFF_64
  607.   intern->ifd           = bfd_h_get_signed_32 (abfd, (bfd_byte *)ext->es_ifd);
  608. #endif
  609.  
  610.   ecoff_swap_sym_in (abfd, &ext->es_asym, &intern->asym);
  611.  
  612. #ifdef TEST
  613.   if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
  614.     abort();
  615. #endif
  616. }
  617.  
  618. /* Swap out an external symbol record.  */
  619.  
  620. static void
  621. ecoff_swap_ext_out (abfd, intern_copy, ext_ptr)
  622.      bfd *abfd;
  623.      const EXTR *intern_copy;
  624.      PTR ext_ptr;
  625. {
  626.   struct ext_ext *ext = (struct ext_ext *) ext_ptr;
  627.   EXTR intern[1];
  628.  
  629.   *intern = *intern_copy;    /* Make it reasonable to do in-place.  */
  630.   
  631.   /* now the fun stuff... */
  632.   if (abfd->xvec->header_byteorder_big_p != false) {
  633.     ext->es_bits1[0] = ((intern->jmptbl ? EXT_BITS1_JMPTBL_BIG : 0)
  634.             | (intern->cobol_main ? EXT_BITS1_COBOL_MAIN_BIG : 0)
  635.             | (intern->weakext ? EXT_BITS1_WEAKEXT_BIG : 0));
  636.     ext->es_bits2[0] = 0;
  637. #ifdef ECOFF_64
  638.     ext->es_bits2[1] = 0;
  639.     ext->es_bits2[2] = 0;
  640. #endif
  641.   } else {
  642.     ext->es_bits1[0] = ((intern->jmptbl ? EXT_BITS1_JMPTBL_LITTLE : 0)
  643.             | (intern->cobol_main ? EXT_BITS1_COBOL_MAIN_LITTLE : 0)
  644.             | (intern->weakext ? EXT_BITS1_WEAKEXT_LITTLE : 0));
  645.     ext->es_bits2[0] = 0;
  646. #ifdef ECOFF_64
  647.     ext->es_bits2[1] = 0;
  648.     ext->es_bits2[2] = 0;
  649. #endif
  650.   }
  651.  
  652. #ifdef ECOFF_32
  653.   bfd_h_put_signed_16 (abfd, intern->ifd, (bfd_byte *)ext->es_ifd);
  654. #endif
  655. #ifdef ECOFF_64
  656.   bfd_h_put_signed_32 (abfd, intern->ifd, (bfd_byte *)ext->es_ifd);
  657. #endif
  658.  
  659.   ecoff_swap_sym_out (abfd, &intern->asym, &ext->es_asym);
  660.  
  661. #ifdef TEST
  662.   if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
  663.     abort();
  664. #endif
  665. }
  666.  
  667. /* Swap in a relative file descriptor.  */
  668.  
  669. static void
  670. ecoff_swap_rfd_in (abfd, ext_ptr, intern)
  671.      bfd *abfd;
  672.      PTR ext_ptr;
  673.      RFDT *intern;
  674. {
  675.   struct rfd_ext *ext = (struct rfd_ext *) ext_ptr;
  676.  
  677.   *intern = bfd_h_get_32 (abfd, (bfd_byte *)ext->rfd);
  678.  
  679. #ifdef TEST
  680.   if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
  681.     abort();
  682. #endif
  683. }
  684.  
  685. /* Swap out a relative file descriptor.  */
  686.  
  687. static void
  688. ecoff_swap_rfd_out (abfd, intern, ext_ptr)
  689.      bfd *abfd;
  690.      const RFDT *intern;
  691.      PTR ext_ptr;
  692. {
  693.   struct rfd_ext *ext = (struct rfd_ext *) ext_ptr;
  694.  
  695.   bfd_h_put_32 (abfd, *intern, (bfd_byte *)ext->rfd);
  696.  
  697. #ifdef TEST
  698.   if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
  699.     abort();
  700. #endif
  701. }
  702.  
  703. /* Swap in an optimization symbol.  */
  704.  
  705. static void
  706. ecoff_swap_opt_in (abfd, ext_copy, intern)
  707.      bfd *abfd;
  708.      PTR ext_copy;
  709.      OPTR *intern;
  710. {
  711.   struct opt_ext ext[1];
  712.  
  713.   *ext = *(struct opt_ext *) ext_copy;
  714.  
  715.   if (abfd->xvec->header_byteorder_big_p != false)
  716.     {
  717.       intern->ot = ext->o_bits1[0];
  718.       intern->value = (((unsigned int) ext->o_bits2[0]
  719.             << OPT_BITS2_VALUE_SH_LEFT_BIG)
  720.                | ((unsigned int) ext->o_bits3[0]
  721.               << OPT_BITS2_VALUE_SH_LEFT_BIG)
  722.                | ((unsigned int) ext->o_bits4[0]
  723.               << OPT_BITS2_VALUE_SH_LEFT_BIG));
  724.     }
  725.   else
  726.     {
  727.       intern->ot = ext->o_bits1[0];
  728.       intern->value = ((ext->o_bits2[0] << OPT_BITS2_VALUE_SH_LEFT_LITTLE)
  729.                | (ext->o_bits3[0] << OPT_BITS2_VALUE_SH_LEFT_LITTLE)
  730.                | (ext->o_bits4[0] << OPT_BITS2_VALUE_SH_LEFT_LITTLE));
  731.     }
  732.  
  733.   _bfd_ecoff_swap_rndx_in (abfd->xvec->header_byteorder_big_p != false,
  734.                &ext->o_rndx, &intern->rndx);
  735.  
  736.   intern->offset = bfd_h_get_32 (abfd, (bfd_byte *) ext->o_offset);
  737.  
  738. #ifdef TEST
  739.   if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
  740.     abort();
  741. #endif
  742. }
  743.  
  744. /* Swap out an optimization symbol.  */
  745.  
  746. static void
  747. ecoff_swap_opt_out (abfd, intern_copy, ext_ptr)
  748.      bfd *abfd;
  749.      const OPTR *intern_copy;
  750.      PTR ext_ptr;
  751. {
  752.   struct opt_ext *ext = (struct opt_ext *) ext_ptr;
  753.   OPTR intern[1];
  754.  
  755.   *intern = *intern_copy;    /* Make it reasonable to do in-place.  */
  756.  
  757.   if (abfd->xvec->header_byteorder_big_p != false)
  758.     {
  759.       ext->o_bits1[0] = intern->ot;
  760.       ext->o_bits2[0] = intern->value >> OPT_BITS2_VALUE_SH_LEFT_BIG;
  761.       ext->o_bits3[0] = intern->value >> OPT_BITS3_VALUE_SH_LEFT_BIG;
  762.       ext->o_bits4[0] = intern->value >> OPT_BITS4_VALUE_SH_LEFT_BIG;
  763.     }
  764.   else
  765.     {
  766.       ext->o_bits1[0] = intern->ot;
  767.       ext->o_bits2[0] = intern->value >> OPT_BITS2_VALUE_SH_LEFT_LITTLE;
  768.       ext->o_bits3[0] = intern->value >> OPT_BITS3_VALUE_SH_LEFT_LITTLE;
  769.       ext->o_bits4[0] = intern->value >> OPT_BITS4_VALUE_SH_LEFT_LITTLE;
  770.     }
  771.  
  772.   _bfd_ecoff_swap_rndx_out (abfd->xvec->header_byteorder_big_p != false,
  773.                 &intern->rndx, &ext->o_rndx);
  774.  
  775.   bfd_h_put_32 (abfd, intern->value, (bfd_byte *) ext->o_offset);
  776.  
  777. #ifdef TEST
  778.   if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
  779.     abort();
  780. #endif
  781. }
  782.  
  783. /* Swap in a dense number.  */
  784.  
  785. static void
  786. ecoff_swap_dnr_in (abfd, ext_copy, intern)
  787.      bfd *abfd;
  788.      PTR ext_copy;
  789.      DNR *intern;
  790. {
  791.   struct dnr_ext ext[1];
  792.  
  793.   *ext = *(struct dnr_ext *) ext_copy;
  794.  
  795.   intern->rfd = bfd_h_get_32 (abfd, (bfd_byte *) ext->d_rfd);
  796.   intern->index = bfd_h_get_32 (abfd, (bfd_byte *) ext->d_index);
  797.  
  798. #ifdef TEST
  799.   if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
  800.     abort();
  801. #endif
  802. }
  803.  
  804. /* Swap out a dense number.  */
  805.  
  806. static void
  807. ecoff_swap_dnr_out (abfd, intern_copy, ext_ptr)
  808.      bfd *abfd;
  809.      const DNR *intern_copy;
  810.      PTR ext_ptr;
  811. {
  812.   struct dnr_ext *ext = (struct dnr_ext *) ext_ptr;
  813.   DNR intern[1];
  814.  
  815.   *intern = *intern_copy;    /* Make it reasonable to do in-place.  */
  816.  
  817.   bfd_h_put_32 (abfd, intern->rfd, (bfd_byte *) ext->d_rfd);
  818.   bfd_h_put_32 (abfd, intern->index, (bfd_byte *) ext->d_index);
  819.  
  820. #ifdef TEST
  821.   if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
  822.     abort();
  823. #endif
  824. }
  825.